#ifndef __INET_SOCKET_ADDRESS_H__
#define __INET_SOCKET_ADDRESS_H__

#include "DSTHType.h"
#ifndef IS_WINDOWS
  #include <arpa/inet.h>
#endif
#include <string>

namespace dsth {

class InetSocketAddress
{
public:
    explicit InetSocketAddress(unsigned short port);
    InetSocketAddress(const char* server, unsigned short port);
    InetSocketAddress(const struct sockaddr_in& addr) : addr_(addr) {}
    InetSocketAddress(const InetSocketAddress& another) { this->addr_ = another.addr_; }
    const struct sockaddr_in& GetSocketAddr() const { return addr_; }
    std::string ToHostPortFormat() const;
    void SetSocketAddr(const struct sockaddr_in& addr) { addr_ = addr; }
private:
    struct sockaddr_in addr_;
};

} // namespace
#endif // __INET_SOCKET_ADDRESS_H__

